<?php
/**
 * Created by PhpStorm.
 * User: Administrator
 * Date: 2019/3/7
 * Time: 12:58
 */

namespace app\common\model;

use app\common\model\User;
use think\Model;


class Wallet extends Model
{



    // 表名
    protected $name = 'wallet';
    protected $hidden = ['salt','pay_password','user_id'];

    // 自动写入时间戳字段
    protected $autoWriteTimestamp = 'int';

    // 定义时间戳字段名
    protected $createTime = 'createtime';
    protected $updateTime = 'updatetime';
    protected $deleteTime = false;

    // 追加属性
    protected $append = [
        'username'
    ];

    public function getUsernameAttr($value, $data)
    {
        return  User::where('id',$data['user_id'])->value('username');
    }

    /**
     * 判断提现密码
     */
    public function checkTixianPwd($wallet,$pwd)
    {
        //$wallet
    }
}